use dataset_polls_meta, clear

keep if appendix != 1

local myvars date house sample mode wording

keep `myvars'

order `myvars'

format date %dm_d_Y

replace sample = subinstr(sample, "National adult", "Adult", 10)
replace sample = "Registered" if sample == "Registered voters"
replace house = subinstr(house, "&", "+", 10)

local j = 0
forvalues i = 1(1)8 {

	preserve
	
	keep if _n <= `j' + 10 & _n > `j'

	#delimit;

	listtex
		*
			using "_output/table_appendix_methodology_`i'.tex"
			,
				replace
				type 
				rstyle(tabular) 	
				head(
				\begin{tabular}{
				>{\raggedright}p{0.1\textwidth}
				>{\raggedright}p{0.2\textwidth}
				p{0.1\textwidth}
				p{0.1\textwidth}
				p{0.4\textwidth}			
				}
				\toprule 
				Date & 
				House &
				Sample & 
				Mode & 
				Wording \\
				\midrule
				)
			foot("\bottomrule\end{tabular}")
			;

	#delimit cr
	
	restore
	
	local j = `j' + 10

}
